Handle read-only queries with informational responses#65
Handle read-only queries with informational responses#65jeffgreendesign merged 4 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe changes add a read-only informational response path for intents that produce no workspace changes. The orchestrator response schema now allows a nullable Sequence DiagramsequenceDiagram
actor User
participant IntentBar as IntentBar Component
participant WorkspaceProvider as WorkspaceProvider
participant Orchestrator as Orchestrator API
User->>IntentBar: Enter input & submit
IntentBar->>WorkspaceProvider: submitIntent(input) (clears infoResponse)
WorkspaceProvider->>Orchestrator: Send intent request
Orchestrator-->>WorkspaceProvider: Response (null/empty changeSet + reasoning/suggestions)
WorkspaceProvider->>WorkspaceProvider: resolveOrchestratorResponse() → set infoResponse, phase="complete"
WorkspaceProvider-->>IntentBar: Context update (infoResponse)
IntentBar->>User: Render read-only panel (reasoning, readerText, suggestions)
User->>IntentBar: Click suggestion
IntentBar->>WorkspaceProvider: dismissInfo() (also set input to suggestion)
WorkspaceProvider->>WorkspaceProvider: Clear infoResponse, phase="idle"
WorkspaceProvider-->>IntentBar: Context update
IntentBar->>User: Input populated and focused
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
components/workspace/intent-bar.tsx (1)
145-147: Constrain reader-text panel height to avoid layout push on long responses.Long
readerTextpayloads can dominate vertical space and bury the input. Consider adding a max height with internal scroll.🧩 Suggested tweak
-<pre className="mt-2 whitespace-pre-wrap text-xs text-muted-foreground"> +<pre className="mt-2 max-h-56 overflow-auto whitespace-pre-wrap text-xs text-muted-foreground"> {infoResponse.readerText} </pre>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@components/workspace/intent-bar.tsx` around lines 145 - 147, The readerText <pre> in intent-bar.tsx can grow arbitrarily and push the layout; constrain its height and enable internal scrolling by giving the <pre> rendering infoResponse.readerText a max-height (e.g., via a class or inline style) and overflow-y: auto so long responses scroll instead of expanding; update the element that renders infoResponse.readerText (the <pre> with className "mt-2 whitespace-pre-wrap text-xs text-muted-foreground") to include the maxHeight/overflow styling so the input area is not pushed offscreen.components/workspace/workspace-provider.tsx (1)
689-701: Extract duplicated informational-response parsing into a shared helper.The two submit paths now duplicate the same parse/branch/cast flow. Consolidating this will reduce drift risk and make future schema changes safer.
♻️ Suggested direction
+function normalizeOrchestratorResponse( + data: z.infer<typeof OrchestratorResponseSchema>, +): { kind: "info"; info: { reasoning: string; readerText?: string; suggestions?: string[] } } + | { kind: "changeset"; changeset: ChangeSet } { + const { changeSet: rawCs, reasoning, readerText, suggestions } = data; + if (!rawCs || !Array.isArray(rawCs.operations) || rawCs.operations.length === 0) { + return { kind: "info", info: { reasoning, readerText, suggestions } }; + } + return { kind: "changeset", changeset: rawCs as unknown as ChangeSet }; +}Then both
submitIntentandsubmitIntentForProductcan call the same helper.Also applies to: 750-760
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@components/workspace/workspace-provider.tsx` around lines 689 - 701, The parsing and informational-response branch (reading validated.data -> { changeSet: rawCs, reasoning, readerText, suggestions } then checking rawCs/operations, calling setDraftChangeset/setInfoResponse/setPhase and casting rawCs to ChangeSet as cs) is duplicated between submitIntent and submitIntentForProduct; extract this logic into a single helper (e.g., parseOrHandleInfoResponse or processValidatedChangeSet) that accepts validated.data and the setters (setDraftChangeset, setInfoResponse, setPhase) and returns either a typed ChangeSet or null, preserve the existing runtime checks (Array.isArray(rawCs.operations) && length > 0) and the unsafe cast through unknown to ChangeSet, and replace the duplicated blocks in submitIntent and submitIntentForProduct with calls to that helper.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CHANGELOG.md`:
- Around line 17-20: There are two "### Fixes" headers under the [Unreleased]
section; remove the duplicate header and move the bullet "- Fix workspace intent
bar erroring on simple questions / read-only queries instead of showing response
text" into the existing "### Fixes" block in the same [Unreleased] section (keep
the exact bullet text and delete the standalone "### Fixes" header). Ensure
there is only one "### Fixes" header under [Unreleased] and preserve surrounding
formatting and spacing.
---
Nitpick comments:
In `@components/workspace/intent-bar.tsx`:
- Around line 145-147: The readerText <pre> in intent-bar.tsx can grow
arbitrarily and push the layout; constrain its height and enable internal
scrolling by giving the <pre> rendering infoResponse.readerText a max-height
(e.g., via a class or inline style) and overflow-y: auto so long responses
scroll instead of expanding; update the element that renders
infoResponse.readerText (the <pre> with className "mt-2 whitespace-pre-wrap
text-xs text-muted-foreground") to include the maxHeight/overflow styling so the
input area is not pushed offscreen.
In `@components/workspace/workspace-provider.tsx`:
- Around line 689-701: The parsing and informational-response branch (reading
validated.data -> { changeSet: rawCs, reasoning, readerText, suggestions } then
checking rawCs/operations, calling setDraftChangeset/setInfoResponse/setPhase
and casting rawCs to ChangeSet as cs) is duplicated between submitIntent and
submitIntentForProduct; extract this logic into a single helper (e.g.,
parseOrHandleInfoResponse or processValidatedChangeSet) that accepts
validated.data and the setters (setDraftChangeset, setInfoResponse, setPhase)
and returns either a typed ChangeSet or null, preserve the existing runtime
checks (Array.isArray(rawCs.operations) && length > 0) and the unsafe cast
through unknown to ChangeSet, and replace the duplicated blocks in submitIntent
and submitIntentForProduct with calls to that helper.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 435749a7-892c-46c3-b9f0-b60c1184ebcb
📒 Files selected for processing (3)
CHANGELOG.mdcomponents/workspace/intent-bar.tsxcomponents/workspace/workspace-provider.tsx
The workspace submitIntent treated all orchestrator responses as action requests, erroring when no operations were generated. Simple questions and read-only queries now display reasoning text and suggestions instead of showing "No operations generated" error. https://claude.ai/code/session_01MdvMfftU9ACHPEvmrwQrs4
- Fix duplicate ### Fixes header in CHANGELOG.md - Constrain readerText pre height with max-h-48 overflow-y-auto - Extract resolveOrchestratorResponse helper to deduplicate submit functions https://claude.ai/code/session_01MdvMfftU9ACHPEvmrwQrs4
…ches The workspace submitIntent and executeChangeset calls were missing the x-demo-session header required by isDemoSession(), causing 401 errors on the demo dashboard. The reader fetch already included this header. https://claude.ai/code/session_01MdvMfftU9ACHPEvmrwQrs4
2313432 to
86a27f6
Compare
Summary
This PR adds support for handling read-only queries and informational responses from the orchestrator. When a user asks a simple question that doesn't require any operations (e.g., "What's the current price?"), the system now displays the response text and suggestions instead of erroring out.
Key Changes
OrchestratorResponseSchemato allowchangeSetto be nullable and added optionalsuggestionsarray fieldsubmitIntentandsubmitIntentForProductto detect when the orchestrator returns no operations and treat it as an informational response rather than an errorinfoResponsestate to store reasoning, readerText, and suggestions from read-only queries, plusdismissInfocallback to clear itImplementation Details
changeSetis null or has zero operations, treating both cases as informational responsessetInfoResponse(null)) is properly integrated into existing cleanup flowshttps://claude.ai/code/session_01MdvMfftU9ACHPEvmrwQrs4